﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Common
{
    /// <summary>
    /// 通用三层架构的业务处理层(BLL)基类
    /// </summary>
    public class FacadeBase : IFacadeBase
    {
        private IPromptInfo _promptInfo;
        /// <summary>
        /// 错误详情
        /// </summary>
        public IPromptInfo PromptInfo
        {
            get
            {
                if (this._promptInfo == null)
                {
                    this._promptInfo = new PromptInfo();
                }
                return this._promptInfo;
            }
        }

        ///// <summary>
        ///// 分页控件
        ///// </summary>
        //public IChangePage ChangePage;

        #region 错误详情上报

        /// <summary>
        /// 错误详情上报
        /// </summary>
        /// <param name="result">错误详情</param>
        protected void Alert(IPromptInfo result)
        {
            this._promptInfo = result;
        }

        /// <summary>
        /// 错误详情上报
        /// </summary>
        /// <param name="restulType">错误类型</param>
        protected void Alert(ResultType restulType)
        {
            this.PromptInfo.Alert(restulType);
        }

        /// <summary>
        /// 错误详情上报
        /// </summary>
        /// <param name="msg">错误信息</param>
        protected void Alert(string msg)
        {
            this.PromptInfo.Alert(msg);
        }

        /// <summary>
        /// 错误详情上报
        /// </summary>
        /// <param name="restulType">错误类型</param>
        /// <param name="result">错误详情</param>
        protected void Alert(ResultType restulType, IPromptInfo result)
        {
            this.PromptInfo.Alert(restulType, result);
        }

        /// <summary>
        /// 错误详情上报
        /// </summary>
        /// <param name="restulType">错误类型</param>
        /// <param name="msg">错误信息</param>
        protected void Alert(ResultType restulType, string msg)
        {
            this.PromptInfo.Alert(restulType, msg);
        }

        /// <summary>
        /// 错误详情上报
        /// </summary>
        /// <param name="msg">错误信息</param>
        /// <param name="result">上级错误信息</param>
        protected void Alert(string msg, IPromptInfo result)
        {
            this.PromptInfo.Alert(msg, result);
        }
        /// <summary>
        /// 错误详情上报
        /// </summary>
        /// <param name="restulType">错误类型</param>
        /// <param name="msg">错误信息</param>
        /// <param name="result">错误详情</param>
        protected void Alert(ResultType restulType, string msg, IPromptInfo result)
        {
            this.PromptInfo.Alert(restulType, msg, result);
        }
        #endregion
    }
}
